package com.cci.kangdao.fieldService.manager.dto.request;

import com.cci.kangdao.entity.BaseEntity;
import com.cci.kangdao.utilTool.CollectionUtils;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.ArrayList;
import java.util.List;

/**
 * @author William Du
 * @date 2020/2/3
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SyncWorkOrderReportRequest extends SyncRequest {

    private String workOrderCrmNo;

    private List<SyncWorkOrderReportRequest.Investigation> investigationList;

    public String getWorkOrderCrmNo() {
        return workOrderCrmNo;
    }

    public void setWorkOrderCrmNo(String workOrderCrmNo) {
        this.workOrderCrmNo = workOrderCrmNo;
    }

    public List<Investigation> getInvestigationList() {
        return investigationList;
    }

    public void setInvestigationList(List<Investigation> investigationList) {
        this.investigationList = investigationList;
    }

    @JsonInclude(JsonInclude.Include.NON_NULL)
    public static class Investigation {

        private String investigationNo;

        @JsonProperty("investigationTitle")
        private String title;

        private List<SyncWorkOrderReportRequest.InvestigationReport> templateList;

        public String getInvestigationNo() {
            return investigationNo;
        }

        public void setInvestigationNo(String investigationNo) {
            this.investigationNo = investigationNo;
        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public List<InvestigationReport> getTemplateList() {
            return templateList;
        }

        public void setTemplateList(List<InvestigationReport> templateList) {
            this.templateList = templateList;
        }
    }

    @JsonInclude(JsonInclude.Include.NON_NULL)
    public static class InvestigationReport {

        private String templateNo;

        private String templateType;

        private String reportTitle;

        private List<SyncWorkOrderReportRequest.ReportData> data;

        public String getTemplateNo() {
            return templateNo;
        }

        public void setTemplateNo(String templateNo) {
            this.templateNo = templateNo;
        }

        public String getTemplateType() {
            return templateType;
        }

        public void setTemplateType(String templateType) {
            this.templateType = templateType;
        }

        public String getReportTitle() {
            return reportTitle;
        }

        public void setReportTitle(String reportTitle) {
            this.reportTitle = reportTitle;
        }

        public List<ReportData> getData() {
            return data;
        }

        public void setData(List<ReportData> data) {
            this.data = data;
        }
    }

    public static class ReportData {

        private String key;

        private String value;

        private List<SyncWorkOrderReportRequest.ExtraData> extraData = new ArrayList<>();

        public String getKey() {
            return key;
        }

        public void setKey(String key) {
            this.key = key;
        }

        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }

        public List<ExtraData> getExtraData() {
            return CollectionUtils.isEmpty(extraData) ? new ArrayList<>() : extraData;
        }

        public void setExtraData(List<ExtraData> extraData) {
            this.extraData = extraData;
        }
    }

    @JsonInclude(JsonInclude.Include.NON_NULL)
    public static class ExtraData {

        private String extraType;

        private String extraUrl;

        public String getExtraType() {
            return extraType;
        }

        public void setExtraType(String extraType) {
            this.extraType = extraType;
        }

        public String getExtraUrl() {
            return extraUrl;
        }

        public void setExtraUrl(String extraUrl) {
            this.extraUrl = extraUrl;
        }
    }

}
